home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / em-xmkit.zip / EMM28_F.ASM < prev    next >
Assembly Source File  |  1989-11-29  |  5KB  |  97 lines

  1. ;-----------------------------------------------------------------------------;
  2. ;      MODULE NAME:   EMM28_F.ASM                                             ;
  3. ;                                                                             ;
  4. ; OS FUNCTION NAME:   alloc_DMA_reg_set                                       ;
  5. ;                                                                             ;
  6. ;      DESCRIPTION:   This function gets the number of a DMA register set     ;
  7. ;                     for an OS/E, if a DMA register set is currently         ;
  8. ;                     available for use.                                      ;
  9. ;                                                                             ;
  10. ;                     In a multitasking operating system, when one task is    ;
  11. ;                     waiting for DMA to complete, it is useful to be able to ;
  12. ;                     switch to another task.  However, if the DMA is being   ;
  13. ;                     mapped through the current register set, the switching  ;
  14. ;                     cannot occur.  That is, all DMA action must be complete ;
  15. ;                     before any remapping of pages can be done.              ;
  16. ;                                                                             ;
  17. ;                     The operating system would initiate a DMA operation on  ;
  18. ;                     a specific DMA channel using a specific alternate map   ;
  19. ;                     register set.  This alternate map register set would    ;
  20. ;                     not be used again, by the operating system or an        ;
  21. ;                     application, until after the DMA operation is complete. ;
  22. ;                     The operating system guarantees this by not changing    ;
  23. ;                     the contents of the alternate map register set, or      ;
  24. ;                     allowing an application to change the contents of the   ;
  25. ;                     alternate map register set, for the duration of the DMA ;
  26. ;                     operation.                                              ;
  27. ;                                                                             ;
  28. ;           PASSED:   &DMA_reg_set:                                           ;
  29. ;                        is a far pointer to the DMA register set parameter.  ;
  30. ;                                                                             ;
  31. ;         RETURNED:   status:                                                 ;
  32. ;                        is the status EMM returns from the call.  All other  ;
  33. ;                        returned results are valid only if the status        ;
  34. ;                        returned is zero.  Otherwise they are undefined.     ;
  35. ;                                                                             ;
  36. ;                     DMA_reg_set:                                            ;
  37. ;                        is the DMA register set number.  If there are no DMA ;
  38. ;                        register sets supported by the hardware, a zero will ;
  39. ;                        be returned.                                         ;
  40. ;                                                                             ;
  41. ; C USE CONVENTION:   unsigned int status;                                    ;
  42. ;                     unsigned int DMA_reg_set;                               ;
  43. ;                                                                             ;
  44. ;                     status = alloc_DMA_reg_set (&DMA_reg_set);              ;
  45. ;-----------------------------------------------------------------------------;
  46. .XLIST
  47. PAGE    60,132
  48.  
  49. IFDEF SMALL
  50.    .MODEL SMALL, C
  51. ENDIF
  52. IFDEF MEDIUM
  53.    .MODEL MEDIUM, C
  54. ENDIF
  55. IFDEF LARGE
  56.    .MODEL LARGE, C
  57. ENDIF
  58. IFDEF COMPACT
  59.    .MODEL COMPACT, C
  60. ENDIF
  61. IFDEF HUGE
  62.    .MODEL HUGE, C
  63. ENDIF
  64.  
  65. INCLUDE emmlib.equ
  66. INCLUDE emmlib.str
  67. INCLUDE emmlib.mac
  68. .LIST
  69. .CODE
  70.  
  71. alloc_DMA_reg_set    PROC                                                  \
  72.             ptr_DMA_reg_set:FAR PTR WORD
  73.  
  74.     ;---------------------------------------------------------------------;
  75.     ;   do;                                                               ;
  76.     ;   .   allocate a DMA register set for use by the OS;                ;
  77.     ;---------------------------------------------------------------------;
  78.     MOVE        AX, allocate_dma_reg_set_fcn
  79.     INT         EMM_int
  80.  
  81.     ;---------------------------------------------------------------------;
  82.     ;   .   pass the DMA register set back to the OS;                     ;
  83.     ;---------------------------------------------------------------------;
  84.     MOVE        DH:DL, 0:BL
  85.     MOVE        ES:BX, ptr_DMA_reg_set
  86.     MOVE        ES:[BX], DX
  87.  
  88.     ;---------------------------------------------------------------------;
  89.     ;   .   return (EMM status);                                          ;
  90.     ;   end;                                                              ;
  91.     ;---------------------------------------------------------------------;
  92.     RET_EMM_STAT    AH
  93.  
  94. alloc_DMA_reg_set        ENDP
  95.  
  96. END
  97.